package org.hk.kg.db;

import java.lang.reflect.Proxy;

import org.hk.kg.exception.KGSQLException;

public class DBServiceProxy {
	public static <T extends IDBService> T getProxyClz(Class<T> clz)
	{
		try
		{
			T proxy = (T) Proxy.newProxyInstance(clz.getClassLoader(),
					clz.getInterfaces(), new DBServiceInvocationHandler(clz.newInstance()));
			return proxy;
		}catch(Exception e)
		{
			throw new KGSQLException("proxy error",e);
		}
	}
}

